package yang.VirtualMachine.chapter9.classStruct.constantPool;

import java.io.IOException;
import java.io.InputStream;

import yang.VirtualMachine.chapter9.ClassBean;
import yang.VirtualMachine.chapter9.ClassUtil;

/**
 * u1 tag;u2 string_index;
 * @author xinxin
 */
public class Con_StringProcesser implements PoolValue {
	
	public static int tag = ConstantPoolController.CONSTANT_String;
	
	private int stringIndex;

	@Override
	public void process(InputStream input) throws IOException {
		stringIndex = (int) ClassUtil.getNumByStream(input, 2);
	}

	@Override
	public String getValue() {
		PoolValue value = ClassBean.getInstance().constantPool[stringIndex];
		return value.getValue();
	}

}
